function url = url_encode(url)
%function url_encode(url) reads a url and replaces the url unaccepted characters
%with its url encoding equivalents
%INPUT: url
%OUTPUT: url

not_allowed = {' ','!', '"', '#', '$', '&', '''','(', ')', '*', '+', '-', ',', '~', '/'};
for i=1:length(not_allowed) 
    replacmts{i} = ['%',dec2hex(not_allowed{i})];
end
url = regexprep(url, not_allowed, replacmts);